<!DOCTYPE html>
{% load static %}
{% load simple_tag %}
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href=" {% static 'blog/css/bulma.css' %}">
    <link rel="stylesheet" href="{% static 'blog/css/style.css' %}">
    {% block head %}
    <title>编程乐园</title>
    {% endblock head %}
</head>
<body style="background-image: url('{% static 'blog/images/timg.jpg'%}')">

  <header class="container menu-header">
    <nav class="navbar is-primary" role="navigation" aria-label="main navigation">
        <div class="navbar-brand">
            <h1 class="navbar-item is-size-3">编程乐园</h1>
          <a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false" data-target="navbarBasicExample">
            <span aria-hidden="true"></span>
            <span aria-hidden="true"></span>
            <span aria-hidden="true"></span>
          </a>
        </div>
      
        <div id="navbarBasicExample" class="navbar-menu has-text-black">
          {% get_category_list as category_list %}
    {% if category_list %}
        <div class="navbar-start">
            <a class="navbar-item {% if request.path == '/' %}is-active{% endif %}" href="{% url 'blog:index' %}">
                首页
            </a>
        {% for category in category_list %}
            <a class="navbar-item {% ifequal slug category.slug %}is-active {% endifequal %}" href="{% url 'blog:category' category.slug %}">
                {{ category.name }}
            </a>
        {% endfor %}    
           
        </div>
    {% else %}
        <p>还没有添加任何分类</p>
    {% endif %} 
    
       <div class="navbar-end">
          <div class="navbar-item">
            {% if user.is_authenticated %}
                <span>欢迎 {{user.username }} 来到编程乐园 &ensp;&ensp; </span>
            <div class="buttons">
                <a href="{% url 'accountt:person' %}" class="button is-info">个人中心</a>
            </div>
            {% else %}
            <div class="buttons">
              <a href="{% url 'login' %}" class="button is-info">登录</a>
              <a href="{% url 'accountt:register' %}" class="button is-primary">注册</a>
            </div>
            {% endif %}
          </div>
          
        </div>

        </div>
    </nav>
  </header>

<!-- 博客导航栏  end-->


<!-- 博客section模块 -->
<div class="container">
  <section class="section has-background-light">
    <div class="columns">

      <!-- 博客左边内容模块 -->
      <div class="column is-8">
        {% block content %}
        {% endblock content %}      
      </div>
      <!-- 博客左边内容模块 -->

      <!-- 博客右侧列表模块 -->
      <div class="column is-4">  
          {% block aside %}

        <!-- 文章归档 -->
        {% get_month_list as archive_list %}
        <div class="box is-shadowless is-radiusless">
          <h1 class="title is-size-5">文章归档</h1>
          {% if archive_list %}
          {% for archive in archive_list %}
          <article class="media" >
              <div class="media-content" >
                <div class="content">
                
                <a href="{% url 'blog:dates' archive.year archive.month %}">{{ archive|date:"Y年m月" }}</a>  
                </div>
              </div>
            </article>
          {% endfor %}
      {% else %}
      <p>还没有任何评论！</p>
      {% endif %}
        </div>
        <!-- 文章归档 end -->

        
        <!-- 侧边栏评论 -->
        {% get_comment_list as comment_list %}
        <div class="box is-shadowless is-radiusless">
          <h1 class="title is-size-5" id="comment">最新评论</h1>
          {% if comment_list %}
              {% for comment in comment_list %}
              <article class="media" style="padding-left: 1rem;">
                  <div class="media-content" >
                    <div class="content">
                      <p>
                        <span class="is-size-7 has-text-grey-light">
                          <a href="">{{ comment.author }}</a> 于 {{ comment.add_date|date }}发表评论：</span><br>
                         <a href="{% url 'blog:article' comment.article.id %}">{{ comment.content }}</a>
                      </p>
                      
                    </div>
                  </div>
                </article>
              {% endfor %}
          {% else %}
          <p>还没有任何评论！</p>
          {% endif %}
        </div>
         <!-- 侧边栏评论 end-->

   <!-- 文章标签 -->
   {% get_tags_list as tags %}
   <div class="box is-shadowless is-radiusless">
     <h1 class="is-size-5 title">文章归档</h1>
     {% if tags %}
     {% for tag in tags %}
     <a href="{% url 'blog:tags' tag.id %}">
      <span class="tag">
        {{ tag }}
      </span>
    </a>
     {% endfor %}
    
 {% else %}
 <p>还没有任何评论！</p>
 {% endif %}
   </div>
   <!-- 文章标签 end -->

          {% endblock aside %} 
      </div>
      <!-- 博客右侧列表模块 end-->


    </div>
  </section>

  <footer style="background-color:rgba(255,255,255,0.2) " class=" footer has-background-primary  has-text-centered">
      <br>
      <p class="has-text-black">Copyright © 2020 物网171 杨帆&田昭</p>
        <p class="has-text-black">Powered by django of Tencent BlueKing</p>
      <p class="has-text-black">邮箱：928891543@qq.com</p>
      <p class="has-text-black">&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;1823984226@qq.com</p>
      <br>
  </footer>

</div>

</body>
</html>